﻿using System.IO;
using System.Xml.Serialization;

namespace SPCoreConsole
{
    public static class ReadXML
    {
        public static void Serialize(string filepath)
        {
            var settings = new Settings();
            var serializer = new XmlSerializer(typeof (Settings));
            var writer = new StreamWriter(filepath);
            serializer.Serialize(writer, settings);
            writer.Close();
        }

        public static Settings Deserialize(string filepath)
        {
            var serializer = new XmlSerializer(typeof (Settings));
            var file = new FileStream(filepath, FileMode.Open);
            var oAddress = serializer.Deserialize(file) as Settings;

            return oAddress;
        }
    }

    public class Settings
    {
        public string Address1;
        public string Address2;
        public string City;
        public string State;
        public string Zip;
    }
}